package com.qlslylq.ad.sdk.config;

import com.qlslylq.ad.sdk.application.AdMergeSDKApp;
import com.qlslylq.ad.sdk.enums.AdPlatformEnum;
import com.qlslylq.ad.sdk.util.ToastUtils;

/**
 * created by qlslylq <br/>
 * on 2022/2/17 <br/>
 */
public class AdMergeHolder {

    /**
     * 启用或禁用平台，仅用于开发中调试，发布时请不要禁用任何平台<br/>
     */
    public static void enablePlatform(AdPlatformEnum platform, boolean enable) {
        switch (platform) {
            case PLATFORM_CSJ:
                CsjMgrHolder.enablePlatform(enable);
                break;
            case PLATFORM_YLH:
                YlhMgrHolder.enablePlatform(enable);
                break;
            case PLATFORM_KS:
                KsMgrHolder.enablePlatform(enable);
                break;
            case PLATFORM_SIGMOB:
                SigmobMgrHolder.enablePlatform(enable);
                break;
            case PLATFORM_MINTEGRAL:
                MintegralMgrHolder.enablePlatform(enable);
                break;
            default:
                ToastUtils.showToast(AdMergeSDKApp.getInstance(), String.format("未识别的平台：%s", platform != null ? platform.getId() : null));
                break;
        }
    }

    /**
     * 获取当前平台是否初始化成功<br/>
     */
    public static boolean isInitSuccess(AdPlatformEnum platform) {
        if (platform == AdPlatformEnum.PLATFORM_CSJ) {
            return CsjMgrHolder.isInitSuccess();
        } else if (platform == AdPlatformEnum.PLATFORM_YLH) {
            return YlhMgrHolder.isInitSuccess();
        } else if (platform == AdPlatformEnum.PLATFORM_KS) {
            return KsMgrHolder.isInitSuccess();
        } else if (platform == AdPlatformEnum.PLATFORM_SIGMOB) {
            return SigmobMgrHolder.isInitSuccess();
        } else if (platform == AdPlatformEnum.PLATFORM_MINTEGRAL) {
            return MintegralMgrHolder.isInitSuccess();
        }
        return false;
    }

}
